<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page isELIgnored="false"%>
<%@ include file="../common/taglibs.jsp"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="renderer" content="webkit">
<title>终端版本管理</title>
<link rel="icon" href="favicon.ico" type="image/x-icon" />
<!-- 当前页面样式 -->
<link rel="stylesheet" href="<s:url value="/css/common.css"/>" />
<!-- 当前页面样式 END -->
<style type="text/css">
.blue {
	color: blue
}
</style>
<script type="text/javascript"
	src="<c:url value="/js/jquery-1.3.2.js" />"></script>
<script type="text/javascript" src="<c:url value="/js/common.js" />"></script>
<script language="javascript" type="text/javascript"
	src="<c:url value="/js/My97DatePicker/WdatePicker.js"/>"></script>
<script type='text/javascript' src='<s:url value="/dwr/engine.js"/>'></script>
<script type='text/javascript'
	src='<s:url value="/dwr/interface/MccQuery.js"/>'></script>
<script type="text/javascript">

function str2date(str){   
	var d=null;   
	var reg=/^(\d{4})(\d{2})(\d{2})$/  ;
	if(arr=str.match(reg)) d=new Date(Number(arr[1]),Number(arr[2])-1,Number(arr[3])) ; 
	return   d;   
}
$(document).ready(function(){
	
		$('#sub').click(function(){
		
			/* var minDate = $.trim($("#minIssueTs").val());
			var maxDate = $.trim($("#maxIssueTs").val()); 
			
		  	if(!minDate || !maxDate){
				alert("请选择发布日期");
				return false;
			}  
			
			var date1=str2date(minDate);
			var date2=new Date();    //结束时间
			
			var date4=str2date(maxDate);
			if(date1.getMonth()!=date4.getMonth()){
			    alert("选择的发布日期不在同一个月内！");
				return false;
			}
		
		 */
		
			$("#queryForm").attr("action","<%=basePath%>/termVer/queryTermVerManage.ct");
			$("#queryForm").submit();
			$(this).attr("disabled","true");
		});
		$('#insertTermVer').click(function(){
			$("#queryForm").attr("action","<%=basePath%>/termVer/insertTermVer.ct");
			$("#queryForm").submit();
		});
		$('#updatetTermVerManage').click(function(){
			var dd = $("input[name=multi_sel]:checked");
			
			if(dd.length != 1){
				alert("请选择一条记录");
				return false;
			}
			var id = dd.val();	
			if(dd.length == 0){
				alert("请选择记录");
				return false;
			}else{
 				$("#updatetTermVerManage").attr("disabled",true);
                $("#queryForm").attr("action","<%=basePath%>/termVer/updateTermVerById.ct?termVer.id="+id);
				$("#queryForm").submit();
			}
		});
		
		$('#deleteTermVer').click(function(){
			var dd = $("input[name=multi_sel]:checked");
			
			if(dd.length != 1){
				alert("请选择一条记录");
				return false;
			}
			var id = dd.val();	
			if(dd.length == 0){
				alert("请选择记录");
				return false;
			}else{
 				$("#deleteTermVer").attr("disabled",true);
                $("#queryForm").attr("action","<%=basePath%>/termVer/deleteTermVerManage.ct?termVer.id="+id);
				$("#queryForm").submit();
			}
		});
		
	});	
	

 function update(id)
	{		
		$("#queryForm").attr("action","<%=basePath%>/termVer/updateTermVerById.ct?termVer.id="+id);
		$("#queryForm").submit();
	}


</script>
</head>

<body>
	<s:form id="queryForm" action="/termVer/queryTermVerManage.ct" method="post"
		theme="simple">
		<table class="tb">
			<tr class="tb-line">
				<td class="tb-td" colspan="6"><div class="tb-h2">POS收单运营管理平台</div></td>
			</tr>
			<tr class="tb-line">
				<td class="tb-td" colspan="6">
					<div class="tb-h3">终端版本管理</div>
				</td>
			</tr>



			<tr class="tb-line">
				<td width="12%" style="min-width: 150px" align="right" class="tb-td">
					<div class="tb-h4" id="blackNum">厂商：</div>
				</td>
				<td class="tb-td"><label class="tb-input-normal"> <s:textfield
							name="searchCondition.manufacturer" cssClass="queryWidth" />
				</label></td>
				<td width="12%" style="min-width: 150px" align="right" class="tb-td">
					<div class="tb-h4">型号：</div>
				</td>
				<td class="tb-td"><label class="tb-input-normal"> <s:textfield
							name="searchCondition.modelId" cssClass="queryWidth" />
				</label></td>

			</tr>
			
			
			<tr class="tb-line">
				<td width="12%" style="min-width: 150px" align="right" class="tb-td">
					<div class="tb-h4" id="blackNum">版本号：</div>
				</td>
				<td class="tb-td"><label class="tb-input-normal"> <s:textfield
							name="searchCondition.versionId" cssClass="queryWidth" />
				</label></td>
					</label>
				</td>
				<td width="12%" style="min-width: 150px" align="right" class="tb-td">
					<div class="tb-h4">发布日期：</div>
				</td>
				<td class="tb-td">
                 	 <label class="tb-input-mini">
	                	<s:textfield id="minIssueTs" name="searchCondition.minIssueTs" onFocus="WdatePicker({dateFmt:'yyyyMMdd',readOnly:true,wdate:true,errDealMode:0});"
							theme="simple" cssClass="queryWidth" /> 
					</label>至：
					<label class="tb-input-mini">
						<s:textfield id="maxIssueTs" name="searchCondition.maxIssueTs" onFocus="WdatePicker({dateFmt:'yyyyMMdd',readOnly:true,wdate:true,errDealMode:0});"
							theme="simple" cssClass="queryWidth" />
					</label>	
                	<!-- <code class="asterisk">*</code> -->
           		 </td>     

			</tr>
				<tr class="tb-line">
				<td width="12%" style="min-width: 150px" align="right" class="tb-td">
                			<div class="tb-h4">版本状态：</div>
            	</td>
				<td class="tb-line">
                			<label class="tb-input-lengthen">
							<s:select list="#{'999':'--请选择--','1':'有效','0':'无效' }" name="searchCondition.isValId" cssClass="queryWidth" />
							</label>
				</td>
			</tr>



			<tr class="tb-line">
				<td colspan="7" align="center"><span style="color: red"><s:actionerror /></span>
					<span style="color: red;"><s:actionmessage /></span> 
					<span style="color: red;"><s:fielderror cssClass="fieldError" /></span>
					<span id="otherError"></span></td>
			</tr>
			
				<td class="tb-td line-submit" align="right" colspan="7">
					<label class="tb-input-submit"><input type="button" value="查询" id="sub" />
					</label> 
					<label class="tb-input-submit">
						<input type="button" value="修改" id="updatetTermVerManage" />
					</label> 
					<label class="tb-input-submit">
						<input type="button" value="添加" id="insertTermVer" />
					</label>
					<label class="tb-input-submit">
						<input type="button" value="删除" id="deleteTermVer" />
					</label>
					<label class="tb-input-submit">
						<s:reset value="取 消" />
					</label>
				</td>
			</tr>

			 <s:if test="#request.searchRsList != null && #request.searchRsList.size>0">
				<tr class="tb-line">
					<td class="tb-td paging"  align="left" colspan="4"> <page:pageCount
								max_pages="11" totalPage="${requestScope.totalPage}"
								currentPage="${requestScope.currentPage}"
								action="${rootPath}/termVer/queryTermVerManage.ct?currentPage=" />

					</td>
				</tr>
			</s:if>
		</table>


		<div class="big-tb">
			<table class="tb" style="width: 100%;">
				<thead>
					<tr class="tb-line">
						<th class="tb-th" colspan="7"><div class="tb-h3">终端版本管理列表</div></th>
					</tr>
					<tr class="tb-line bg-gray">
						<th class="tb-th">选择</th>
						<th class="tb-th">厂商</th>
						<th class="tb-th">型号</th>
						<th class="tb-th">版本号</th>
						<th class="tb-th">发布日期</th>
						<th class="tb-th">是否有效</th>
						<th class="tb-th">操作人</th>
					</tr>
				</thead>
				<tbody>
					<s:iterator value="#request.termVerManageList" status="stat" id="termVer">
						<tr class="tb-line">
							<td class="tb-td" align="center">
							 <s:checkboxlist  name="multi_sel" list="#{#termVer.id:''}"  theme="simple" />
							</td>
							<td class="tb-td"><s:property value="#termVer.manufacturer" /></td>
							<td class="tb-td"><s:property value="#termVer.modelId" /></td>
							<td class="tb-td"><s:property value="#termVer.versionId" /></td>
							<td class="tb-td"><s:property value="#termVer.issueTs" /></td>
							<td class="tb-td"><s:property value="#termVer.isValId" /></td>
							<td class="tb-td"><s:property value="#termVer.opId" /></td>
					</s:iterator>
				</tbody>
			</table>
		</div>
	</s:form>
	<s:if test="#request.info_request !=null">
		<script language="javascript">
	    alert("${request.info_request}");
	    </script>
	</s:if>
</body>
</html>
